package stark.app.function.applock;

import android.text.Editable;
import android.text.TextWatcher;

import com.stark.applock.lib.AppLockModule;

import stark.app.R;
import stark.app.databinding.ActivityAppUnlockBinding;
import stark.common.basic.base.BaseNoModelActivity;

/**
 * Author：daizhongbin on 2022/8/2
 * Email：1027154338@qq.com
 * Desc:
 */
public class AppUnlockActivity extends BaseNoModelActivity<ActivityAppUnlockBinding> {

    @Override
    protected int onCreate() {
        return R.layout.activity_app_unlock;
    }

    @Override
    protected void initView() {
        mDataBinding.tvHint.setText("请输入解锁密码" + AppLockModule.getUnlockPassword());
        mDataBinding.etPwd.addTextChangedListener(new TextWatcher() {
            @Override
            public void beforeTextChanged(CharSequence s, int start, int count, int after) {
            }

            @Override
            public void onTextChanged(CharSequence s, int start, int before, int count) {
            }

            @Override
            public void afterTextChanged(Editable s) {
                String inputPwd = s.toString().trim();
                if (AppLockModule.isPasswordMatch(inputPwd)) {
                    finish();
                }
            }
        });
    }

    @Override
    protected void initData() {
    }

    @Override
    public void onBackPressed() {
        //super.onBackPressed();
    }

}
